<template>
	<view>
		<!-- 商品信息 -->
		<view class="shop_info" v-for="(item,index) in detail_info.order_item" :key="index">
			<view class="info">
				<image :src="item.g_pic" mode=""></image>
			</view>
			<view class="info_content">
				<text class="tit">{{item.goodname}}</text>
				<view class="price">
					<text>¥<text class="money">{{item.price}}</text> </text>
					<text>x{{item.nums}}</text>
				</view>
			</view>
		</view>
		
		<!-- 实付款 -->
		<view class="pay_money">
			<text>物流状态：</text>
			<text v-if='logistics.state == 0'>在途</text>
			<text v-if='logistics.state == 1'>揽收中</text>
			<text v-if='logistics.state == 2'>疑难</text>
			<text v-if='logistics.state == 3'>已签收</text>
			<text v-if='logistics.state == 4'>退签</text>
			<text v-if='logistics.state == 5'>派件中</text>
			<text v-if='logistics.state == 8'>清关中</text>
			<text v-if='logistics.state == 14'>拒签</text>
		</view>
		
		<view class="pay_money">
			<text>物流公司：</text>
			<text >{{logistics.express}}</text>
		</view>
		
		<!-- 订单信息 -->
		<view class="msg">
			<view class="msg_s">
				<text>物流单号</text>
				<text class="texts">{{logistics.nu}}</text>
				<view class="copy line_center" @click="paste(logistics.nu)">
					复制
				</view>
			</view>
		</view>
		
		
		<view class="wrap">
			<view class="logistics-info-wrap">
				<view class="title">物流信息</view>
				<view class="logistics-info-con">
					<template v-for='(item,index) in logistics.data'>
						<view class="logistics-info-item" v-if='index == 0'>
							<view class="logistics-info-icon-check center">
								<view class="logistics-info-icon-check-inner"></view>
							</view>
							<view class="logistics-info-text">
								<view class="logistics-info-text1">{{item.context}}</view>
								<view class="logistics-info-text2">{{item.time}}</view>
							</view>
						</view>
						<view class="logistics-info-item" v-else>
							<view class="logistics-info-icon"></view>
							<view class="logistics-info-text">
								<view class="logistics-info-text1 logistics-info-text3">{{item.context}}</view>
								<view class="logistics-info-text2">{{item.time}}</view>
							</view>
						</view>
					</template>
				</view>
			</view>
		</view>
		
		
		

	</view>
</template>

<script>
	const app = getApp();
	export default {
		
		data() {
			return {
				order_sn: '',
				logistics: '',
				detail_info: ''
			};
		},
		onLoad(opt) {
			this.order_sn = opt.order_sn
			this.order_details()
			this.take_detail()
		},
		methods:{
			
			// 订单详情
			order_details(){
				let that = this;
				app.globalRequest({
					api: app.getApi().user.orderDetail,
					data: {
						order_sn: that.order_sn
					},
					method: 'post'
				}).then(res => {
					if (res.code == 1) {
						that.detail_info = res.data
					}
				}).catch(err => {
				
				})
			},
			// 复制
			paste(value) {
			   uni.setClipboardData({
			   	data: value, // data的值为你要复制的内容
			   	success: res => {
			   		uni.showToast({
			   			title:'物流单号复制成功',
			   			icon:'none'
			   		})
			   	}
			   });
			},
			
			// 物流信息
			take_detail(){
				let that = this;
				app.globalRequest({
					api: app.getApi().user.takeDetail,
					data: {
						order_sn: that.order_sn
					},
					method: 'post'
				}).then(res => {
					if (res.code == 1) {
						console.log(res)
						that.logistics = res.data
					}
				}).catch(err => {
				
				})
			}
		}
	}
</script>

<style lang="scss" >
	page{
		padding-bottom: 20rpx;
		margin-top: 20rpx;
	}
	.shop_info{
		width: 92%;
		margin: 0rpx auto 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx 28rpx;
		box-sizing: border-box;
		background-color: #fff;
		border-radius: 4rpx;
		.info{
			width: 176rpx;
			height: 176rpx;
			image{
				width: 100%;
				height: 100%;
				border-radius: 16rpx;
			}
		}
		.info_content{
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			height: 176rpx;
			width: 68%;
			.tit{
				color: #000000;
				font-size: 28rpx;
			}
			.price{
				display: flex;
				align-items: center;
				justify-content: space-between;
				text{
					color: #323233;
					font-size: 28rpx;
					.money{
						color: #323233;
						font-size: 32rpx;
						margin-left: 10rpx;
					}
				}
			}
		}
	}
	
	.pay_money{
		width: 92%;
		margin: 20rpx auto 0;
		padding: 30rpx 24rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		// justify-content: space-between;
		background-color: #fff;
		border-radius: 4rpx;
		text{
			font-size: 28rpx;
			color: #333;
		}
		.num{
			margin-left: 30rpx;
		}
	}
	.msg{
		width: 92%;
		background-color: #fff;
		display: flex;
		flex-direction: column;
		padding: 12rpx 20rpx;
		box-sizing: border-box;
		margin: 20rpx auto 0;
		border-radius: 10rpx;
		.msg_s{
			padding: 20rpx 0;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			color: #333;
			.texts{
				display: block;
				width: 60%;
			}
		}
	}
	.copy{
		width: 100rpx;
		height: 52rpx;
		background: #FFFFFF;
		border-radius: 26rpx;
		border: 2rpx solid $dis-font-color;
		color:$dis-font-color;
	}
	
	.wrap {
		padding-top: 0rpx;
	}
	
	.info-wrap {
		margin: 0 30rpx;
		padding: 30rpx;
		background: #fff;
		border-radius: 8rpx;
		display: flex;
	
		image {
			width: 152rpx;
			height: 152rpx;
			border-radius: 8rpx;
			background: rebeccapurple;
			margin-right: 22rpx;
		}
	
		.info-right-wrap {
			font-size: 26rpx;
		}
	
		text {
			color: #FE6E00
		}
	
		.info-right-status1 {
			padding-top: 20rpx;
		}
	}
	
	.logistics-info-wrap {
		margin: 20rpx 30rpx;
		padding: 18rpx 0rpx 30rpx;
		background: #fff;
		border-radius: 8rpx;
	
		.title {
			font-size: 26rpx;
			font-weight: bold;
			padding-left: 14rpx;
		}
	}
	
	.logistics-info-con {
		margin-left: 30rpx;
		margin-right: 14rpx;
		margin-top: 30rpx;
	}
	
	.logistics-info-item {
		display: flex;
		border-left: 1px solid rgba(191, 191, 191, 0.4);
		padding-bottom: 40rpx;
		font-size: 26rpx;
	
		&:last-of-type {
			border-left: 0;
		}
	
		.logistics-info-icon {
			width: 24rpx;
			height: 24rpx;
			background: rgba(191, 191, 191, 1);
			border-radius: 100%;
			flex-shrink: 0;
			margin-right: 36rpx;
			margin-left: -14rpx;
		}
	
		.logistics-info-icon-check {
			width: 36rpx;
			height: 36rpx;
			border-radius: 100%;
			background: rgba(254, 110, 0, 0.3);
			flex-shrink: 0;
			margin-right: 36rpx;
			margin-left: -18rpx;
			margin-top: -6rpx;
			    display: flex;
			    align-items: center;
			    justify-content: center;
			.logistics-info-icon-check-inner {
				width: 24rpx;
				height: 24rpx;
				background: #FE6E00;
				border-radius: 100%;
			}
	
		}
	
		.logistics-info-text {
			line-height: 40rpx;
		}
	
		.logistics-info-text2 {
			color: #BFBFBF;
			padding-top: 12rpx;
		}
	
		.logistics-info-text3 {
			color: #BFBFBF;
		}
	}
</style>
